<style type="text/css">
    @media only screen and (min-width: 450px) {
        .a {
            width: 310px;
            position: absolute;
            left: calc(100% / 2 - 170px);
            margin-top: 150px;
            /*box-shadow: 0px 0px 20px #888888;;*/
            padding: 10px;
            /*padding-top: 5px;*/
            border-radius:1px;
            /*background: rgba(0,0,0,0.3);*/
            
        }
        body {
            /*background: #ddd;*/
            background: #eee;
        }
    }
    .a .other{
            margin-top: 10px;
            display: inline-block;
        }
    .a h2{
            margin-top: 5px;
            margin-bottom: 20px;
            text-align: center;
            color: gray;
        }
    .verification{
        width: 100%;
        margin-bottom: 10px;
    }
    .verification .ver-img img{
        cursor: pointer;
        height: 38px;
        width: 100px;
        border: 1px solid #e6e6e6;
    }
    .verification .ver-input{
        float: right;
        margin: 0;
    }
    .enian-float-right{
        float: right;
    }
    body a{
        cursor: pointer;    
    }
    .qr-login img{
        margin-top: 10px;
        height: 170px;
        
    }
    .qr-login .content{
        margin: auto;
        text-align: center;
    }
    .qr-login .content .text{
        margin-top: 20px;
    }
    .qr-login .content .wxapp-qr{
        color: blueviolet;
    }
    #wxapp-logo{
        position: absolute;
        top: 30px;
        /*border: 1px solid darkgray;*/
        
        left: calc(100% - 50% - 170px / 2);
    }
    #wxapp-logo img{
        border: 1px solid #e6e6e6;
        height: 150px;
    }
    @media only screen and (max-width: 449px) {
        .a {
            width: 90%;
            margin: 60px auto;
        }
    }
</style>
<div class='layui-main a'>
    <h2  class="title">日历记事本 - 注册</h2>

    <form class="layui-form layui-form-pane" action="" method="POST" lay-filter="register">

        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="username" required lay-verify="required" placeholder="请输入邮箱作为账号" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">昵称</label>
            <div class="layui-input-block">
                <input type="text" name="name" required lay-verify="required" placeholder="请输入昵称" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-block">
                <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">确认密码</label>
            <div class="layui-input-block">
                <input type="password" name="password_again" required lay-verify="required" placeholder="请再输入一次密码" class="layui-input">
            </div>
        </div>

        
        
        <div class="layui-form-item" align="center">
            <a class="layui-btn layui-btn-fluid layui-btn-normal" lay-submit="" id='btn_regster'>注册</a>
        </div>
<!--         <a href="">注册账号</a>
        <a class="enian-float-right" href="">忘记密码?</a> -->
        
    </form>
</div>

        

<script>
    app.base.loadApi('apiLogin');
    layui.use(['form', 'layer','jquery','laytpl','apiLogin'], function() {
        var form = layui.form;
        var $ = layui.jquery;
        var laytpl = layui.laytpl;
        var timeOut
        var qrContent={
                type:'login'
                ,code:false
            };

        app.base.setTitle('日历记事本 - 注册');
       
        $('#btn_regster').click(function(){
            var data= form.val('register');
            if(data.password!==data.password_again){
                layer.msg('两次密码输入不一致');
                return;
            }
            var loading_layer= layer.msg('加载中', {
                icon: 16
                , shade: 0.01
                , time: 0
            });
            layui.apiLogin.registerSubmit(data.username, data.password,data.name,function(){
                layer.close(loading_layer);
                layer.msg('邮件已成功发送至邮箱，请前去邮箱进行注册！');
                app.go(app.base.route.login);
            },function(msg){
                layer.msg(msg)
            })
        })
     
    });
</script>
